package com.wyj.server;

import java.util.List;

/**
 * TODO: servlet容器
 *
 * @author wuyijie
 * @date 2021/12/13 21:51
 */
public class Server extends BaseLiflecycleBean{
    private List<Service> serviceList;

    public Server() {
    }

    public Server(List<Service> serviceList) {
        this.serviceList = serviceList;
    }

    public List<Service> getServiceList() {
        return serviceList;
    }

    public void setServiceList(List<Service> serviceList) {
        this.serviceList = serviceList;
    }

    @Override
    public String toString() {
        return "Server{" +
                "serviceList=" + serviceList +
                '}';
    }

    @Override
    public void init() {
        this.setServiceList(Digester.SERVICE_LIST);
        for (Service service : getServiceList()) {
            service.init();
        }
    }

    @Override
    public void start() {
        for (Service service : getServiceList()) {
            service.start();
        }

    }
}
